using System;
using System.Drawing;

namespace SiRtEt
{
	/// <summary>
	/// The basic Unit Square in the Game... all figures are made of these
	/// </summary>
	public class UnitSquare
	{
		#region Members
			public Rectangle	TheSquare;		// The unit square itself
			public bool		ColorFlag;		// To check if its to be colored 
			public Color		FillColor;		// The color (if any)
			public TheWorld	BelongsTo;		// The complete panel of which its a part of
		#endregion

		#region Constructor
		/// <summary>
		/// The Constructor : Initializes the unit square
		/// </summary>
		/// <param name="theWorld"> The world it belongs to</param>
		public UnitSquare(TheWorld theWorld)
		{
			TheSquare	= Rectangle.Empty;
			ColorFlag	= false;
			BelongsTo	= theWorld;
			FillColor	= new Color();
		}
		#endregion

		#region Methods
		/// <summary>
		/// Rendering the Unit Square in the render area
		/// </summary>
		/// <param name="renderArea">The graphics object which is used as the rendering area</param>
		public void Render(Graphics renderArea)
		{
			// Drawing the filled rectangle with the given fill color
			renderArea.FillRectangle(new SolidBrush(FillColor),
										TheSquare.Left+1,TheSquare.Top+1,
										TheSquare.Width-1,TheSquare.Height-1);

			// Drawing the borders of the unit square
/*			renderArea.DrawRectangle(new Pen(Color.Black,3),
										TheSquare.Left,TheSquare.Top,
										TheSquare.Width,TheSquare.Height);
*/										
		}
		#endregion
	}
}
